Page({
  /**
   * 页面的初始数据
   */
  data: {
    date:'',
    list:[],
  },
  start(e){
  },
  changedate(e){
    this.setData({
      date:e.detail.dateString,
    });
    var app = getApp();
    const id = app.globalData.useropenid;
    var that = this;
    const db = wx.cloud.database().collection("List");
    db.where({data:that.data.date,_openid:id}).orderBy('data','desc').get({
      success: function(res) {
        // res.data 是包含以上定义的两条记录的数组
        const templist = res.data
        //console.log(templist);
        that.setData(
          {
            list:templist,
          }
        )
      } 
    })
  },
  onLoad(){
    var app = getApp();
    if(!app.globalData.hasLogin)
    {
      setTimeout(
        function () { //注意function这里不能缺少
          wx.switchTab({
            url: '../my/my',
          })
        }, 1500)
      wx.showToast({
        title: '请登录后再查看',
        icon:"error",
      })
    }
  }
})